import { usePriceStore } from "@/store/price";
import { Button } from "antd";
import TestDemo from "./testDemo";
export default function PriceDemo() {
  const { price, setPrice, addPrice, subtractPrice, resetPrice, getPrice } =
    usePriceStore();

  const getData = () => {
    // 获取数据
    const price = getPrice();
    console.log(price);
  };

  return (
    <div>
      <h1>PriceDemo</h1>
      <p>price: {price}</p>
      <TestDemo />
      <Button onClick={() => setPrice(100)}>设置</Button>
      <Button onClick={() => addPrice()}>增加1</Button>
      <Button onClick={() => subtractPrice()}>减少1</Button>
      <Button onClick={() => resetPrice()}>重置</Button>
      <Button onClick={() => getData()}>获取</Button>
    </div>
  );
}
